import request from '@/utils/request'

// 查询店铺商品列表
export function listGood(query) {
  return request({
    url: '/fx/store/good/list',
    method: 'get',
    params: query
  })
}

// 查询店铺商品详细
export function getGood(id) {
  return request({
    url: '/fx/store/good/' + id,
    method: 'get'
  })
}

// 商品补货(店铺自加)
export function replenishment(data) {
  return request({
    url: '/fx/store/good/replenishment',
    method: 'post',
    data: data
  })
}

// 商品补货(采购)
export function replenish(data) {
  return request({
    url: '/fx/order/replenish',
    method: 'post',
    data: data
  })
}

// 新增店铺商品
export function addGood(data) {
  return request({
    url: '/fx/store/good',
    method: 'post',
    data: data
  })
}


// 新增店铺商品
export function addstoreGood(data) {
  return request({
    url: '/fx/store/good/addGood',
    method: 'post',
    data: data
  })
}

// 修改店铺商品
export function updatastoreGood(data) {
  return request({
    url: '/fx/store/good',
    method: 'put',
    data: data
  })
}

// 上下架店铺商品
export function updateGood({ id,isInitiate, source }) {
  return request({
    url: `/fx/store/good/upOrDown?id=${id}&isInitiate=${isInitiate}&source=${source}`,
    method: 'get',
  })
}

// 删除店铺商品
export function delGood(id) {
  return request({
    url: '/fx/store/good/' + id,
    method: 'delete'
  })
}

/**商品审核是否通过 */
export function goodAudit(data) {
  return request({
    url: '/fx/store/good/audit',
    method: 'put',
    data
  })
}
